package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import pojo.User;
import service.UserService;

@Controller
@RequestMapping("/user")


public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/login")
    public  String login(User user){
   boolean flag=userService.login(user);
   if(flag){
       return "index";
   }
       else{
           return "login";
   }
    }



    @RequestMapping("/list")
    public String findAll(){
        return "user/list";
    }



    @RequestMapping("/add")
    public String add(){
        return "user";
    }

    @RequestMapping("/update")
    public String update(){
        return "user";
    }

}
